package com.yoi.SendAndRecv;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Date;
//  Version3

/**
 * yuquan账户发送的Hello1，Hello2的信息
 */
@Component
public class Sender3 {

    @Resource(name="ThirdRabbitTemplate")
    private RabbitTemplate firstRabbitTemplate;

    public void send1() {
        String context = "hello1 " + new Date();
        System.out.println("Sender2 : " + context);
        this.firstRabbitTemplate.convertAndSend("Second-exchange","hello1.bbb", context);

    }

    public void send2() {
        String context = "hello2 " + new Date();
        System.out.println("Sender2 : " + context);
        this.firstRabbitTemplate.convertAndSend("Second-exchange","hello2.bbb", context);

    }

    public void send3() {
        String context = "hello3 " + new Date();
        System.out.println("Sender2 : " + context);
        this.firstRabbitTemplate.convertAndSend("fanout-exchange","", context);
     }

    public void send4() {
        String context = "hello4 " + new Date();
        System.out.println("Sender2 : " + context);
        this.firstRabbitTemplate.convertAndSend("direct-exchange","Direct", context);
    }

    public void send5() {
        String context = "hello5 " + new Date();
        System.out.println("Sender2 : " + context);
        this.firstRabbitTemplate.convertAndSend("direct-exchange","Direct", context);
    }

}
